package com.yc.shadowdemo.ui

import android.widget.Toast
import androidx.lifecycle.LiveData
import com.yc.commontlib.base.YcBaseActivityPlus
import com.yc.commontlib.extension.ycLogE
import com.yc.commontlib.net.doFail
import com.yc.commontlib.net.doSuccess
import com.yc.shadowdemo.databinding.WelcomeActivityBinding
import com.yc.shadowdemo.viewmodel.WelcomeVM

/**
 * Creator: yc
 * Date: 2021/6/15 16:22
 * UseDes:
 */
class WelcomeActivity : YcBaseActivityPlus<WelcomeActivityBinding>(WelcomeActivityBinding::inflate) {
    private val mViewModel: WelcomeVM by ycViewModels()
    override fun WelcomeActivityBinding.initView() {
        tv.text = "hello word"
        mViewModel.mVersion.observe {
            it.doSuccess {
                show("请求成功")
                ycLogE("data:$it")
            }.doFail { 
                show("请求失败")
            }
        }
        mViewModel.checkVersion()
    }
}

